# Maintainer: Muflone http://www.muflone.com/contacts/english/

pkgname=perl-data-uuid
_perl_namespace=Data
_perl_module=UUID
pkgver=1.226
pkgrel=3
pkgdesc="Globally/Universally Unique Identifiers (GUIDs/UUIDs)"
arch=('loong64' 'x86_64')
url="https://metacpan.org/release/${_perl_namespace}-${_perl_module}"
license=('BSD')
depends=('perl')
source=("https://www.cpan.org/modules/by-module/${_perl_namespace}/${_perl_namespace}-${_perl_module}-${pkgver}.tar.gz")
sha256sums=('093d57ffa0d411a94bafafae495697db26f5c9d0277198fe3f7cf2be22996453')
options=('!emptydirs')

build() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  perl Makefile.PL
  make
}

check() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  make test
}

package() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  make pure_install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
  # Install license file
  install -m 755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" "LICENSE"
}
